import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/newsHomepage' },
    { path: '/login', component: () => import('@/views/login/LoginPagePlue.vue') }, // 登录页
    { path: '/userHome', component: () => import('@/views/user/UserHome.vue') }, // 用户页
    {
      path: '/userReleaseNews', // 发布页
      component: () => import('@/views/user/UserReleaseNews.vue')
    },
    // 新闻
    {
      path: '/newsNavigation', //新闻导航栏
      component: () => import('@/views/news/NewsNavigation.vue'),
      redirect: '/newsHomepage', //重定向首页
      children: [
        {
          path: '/newsHomepage', //首页
          name: 'newsHomepage',
          component: () => import('@/views/news/NewsHomepage.vue')
        },
        {
          path: '/newsClassification/:words', //分类页面
          name: 'newsClassification',
          component: () => import('@/views/news/NewsClassification.vue')
        },
        {
          path: '/newsDetail/:words', //详情页面页面
          name: 'newsDetail',
          component: () => import('@/views/news/NewsDetail.vue')
        }
      ]
    },
    // 管理员
    {
      path: '/admin', //管理员界面
      component: () => import('@/views/admin/layout/LayoutContainer.vue'),
      redirect: '/admin/AdminHomepage', //重定向管理员首页
      children: [
        {
          path: '/admin/AdminHomepage', //首页
          name: 'AdminHomepage',
          component: () => import('@/views/admin/AdminHomepage.vue')
        },
        {
          path: '/admin/NewsManage', //新闻管理
          name: 'NewsManage',
          component: () => import('@/views/admin/NewsManage.vue')
        },
        {
          path: '/admin/NewsProgram', //新闻栏目
          name: 'NewsProgram',
          component: () => import('@/views/admin/NewsProgram.vue')
        },
        {
          path: '/admin/UserManage', //用户管理
          name: 'UserManage',
          component: () => import('@/views/admin/UserManage.vue')
        },
        {
          path: '/admin/UserComment', //评论管理
          name: 'UserComment',
          component: () => import('@/views/admin/UserComment.vue')
        },
        {
          path: '/admin/AdminNews', //管理员发布
          name: 'AdminNews',
          component: () => import('@/views/admin/AdminNews.vue')
        },

      ]
    },
    //测试
    {
      path: '/test', // 评论测试
      component: () => import('@/views/comment/TestComment.vue')
    },
    //个人收藏
    {
      path:'/collection',
      component: () => import('@/views/collection/index.vue')
    }
  ]
})

export default router
